package org.lanqiao.tjut.control;

import java.io.IOException;

import javax.servlet.ServletException;
import javax.servlet.http.HttpServlet;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;

import org.lanqiao.tjut.bean.ScoreBean;
import org.lanqiao.tjut.myUtils.MyUtils;
import org.lanqiao.tjut.service.ServiceFactory;

public class DeleteSelectedClass extends HttpServlet {

	private static final long serialVersionUID = 1L;

	@Override
	protected void service(HttpServletRequest request, HttpServletResponse response)
			throws ServletException, IOException {
		// 创建成绩表实例对象
		ScoreBean score = (ScoreBean) MyUtils.getNewInsdence(ScoreBean.class);
		// 获取要退课的课程名和教师名和学生名
		String classname = request.getParameter("classname");
		String teaname = request.getParameter("teaname");
		String stuname = request.getParameter("stuname");
		// 赋值
		score.setClassname(classname);
		score.setTeaname(teaname);
		score.setStuname(stuname);
		// 删除课程
		ServiceFactory.getSelectClassManagerServiceInstance().deleteStuClass(score);
		// 跳转到查询课程页面
		request.getRequestDispatcher("QueryStuSelfClass2").forward(request, response);

	}

	@Override
	public void destroy() {
		// TODO Auto-generated method stub
		super.destroy();
	}

	@Override
	public void init() throws ServletException {
		// TODO Auto-generated method stub
		super.init();
	}

}
